<?php
namespace app\index\model;
use app\index\validate\Tablea as TableaValidate;
class productTable extends Common
{
	protected $table = 'product_list';
	public function productaddData($data){
		$res = productTable::create($data);
		if($res){
			return $this->message('200','添加成功');
		}else{
			return $this->message('400','添加失败');
		}
	}
	public function producteditData($data){
		$res = productTable::update($data,$data['id']);
		if($res){
			return $this->message('200','更新成功');
		}else{
			return $this->message('400','更新失败');
		}
	}
	public function productdel($id){
		$res = productTable::get($id)->delete();
		if($res){
			return $this->message('200','删除成功');
		}else{
			return $this->message('400','删除失败');
		}
	}
	public function searchProductNameAttr($query, $value, $data)
	   {
	       $query->where('product_name','like', $value .'%');
	   }
}